Scripting > CxHmiCas > CxHmiCas3 Object > CxHmiCas3 Methods

CxHmiCas3 Methods

The CxHmiCas3 object contains the following methods:

AddFilter

The AddFilter method changes the current unit set.

Syntax

AddFilter(Property As String, Operator As String, Value As String) As Boolean

Parameters

Parameter Required Description

Property

Yes

The property being filtered.

Operator

Yes

The operator that compares the property to the value.

Value

Yes

The value being compared to the property.

Remarks

This is the legacy function that was used to add filters. With the new implementation of rules, this function will only allow adding a single rule with the given values to the highest level rule set.  This will preserve backwards compatibility but should not be used.

This method filters the displayed alarms by the property, operator, and value given. If the method returns False, there was an error in adding the filter.

Example

Sub btnAddFilter_EventClick()

Dim This : Set This = btnAddFilter

Dim bRet

Dim strProperty

Dim strOperator

Dim strValue

 

'Displays alarms where the Primary Value is greater than 600

strProperty = "Primary Value"

strOperator = ">"

strValue = 600

 

bRet = CasCtrl.AddFilter(strProperty, strOperator, strValue)

 

If (bRet <> True) Then

Msgbox("Error in AddFilter!")

End If

 

CasCtrl.RefreshContents

 

End Sub

Back to top

AllowUserChanges

The AllowUserChanges method allows or disallows the user to change properties at runtime.

Syntax

AllowUserChanges(Allow As Boolean)

Parameters

Parameter Required Description

Allow

Yes

If this parameter is set to True, the user is allowed to make changes to the form.

Example

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

Dim g_bAllowChanges

If (g_bAllowChanges = True) Then

g_bAllowChanges = False

Else

g_bAllowChanges = True

End If

 

CasCtrl.AllowUserChanges g_bAllowChanges

 

End Sub

Back to top

ClearFilters

The ClearFilters method clears all rules and filters from the control.

Syntax

ClearFilters()

Example

The following example clears all rules from CasCtrl and alerts the user.

Sub clearFilters()

CasCtrl.ClearFilters

CasCtrl.RefreshContents

MsgBox "Rules have been cleared"

End Sub

Back to top

ClearSilenceTime

The ClearSilenceTime method clears out any alarm silence time that may have been set. This will cause any alarms that would cause sound to be played, but had been silenced, to resume playing sound.

Syntax

ClearSilenceTime()

Example

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

CasCtrl.ClearSilenceTime

End Sub

Back to top

EnableAllRules

The EnableAllRules method enables or disables all rules and vectors, either unilaterally, or for the specified level. Passing True for Enable enables all rules; passing False disables all rules.

Syntax

EnableAllRules(Enable As Boolean)

Parameters

Parameter Required Description

Enable

Yes

If this parameter is set to True, all rules will be enabled.  Otherwise, all rules will be disabled.

Example

The following example toggles whether all rules are enabled or disabled.

Sub enableAllRules()

If enableState = True Then

CasCtrl.EnableAllRules(False)

enableState = False

Else

CasCtrl.EnableAllRules(True)

enableState = True

End If

CasCtrl.RefreshContents

End Sub

Back to top

EnableCASViewCustomAttributeFiltering

The EnableCASViewCustomAttributeFiltering method enables or disables the use of CAS custom attributes.

Syntax

EnableCASViewCustomAttributeFiltering(Enable As Boolean)

Parameters

Parameter Required Description

Enable

Yes

If this parameter is set to True, custom attribute filtering will be enabled.  Otherwise, custom attribute filtering will be disabled.

Remarks

This method is used by CygNet Explorer, and should not be used in script.

Example

The following example toggles custom attribute filtering and alerts the user that it has been enabled or disabled.

Sub enableCustomAttrFiltering()

If bEnabled Then

CasCtrl.EnableCASViewCustomAttributeFiltering False

bEnabled = False

edtMessageBox.Text = "Custom attribute filtering is now disabled"

Else

CasCtrl.EnableCASViewCustomAttributeFiltering True

bEnabled = True

edtMessageBox.Text = "Custom attribute filtering is now enabled"

End If

End Sub

Back to top

EnableDClickPropDIg

The EnableDClickPropDlg method enables or disables launching of a Point Properties dialog box when a row is double-clicked.

Syntax

EnableDClickPropDlg(Enable As Boolean)

Parameters

Parameter Required Description

Enable

Yes

If this parameter is set to True, a Point Properties dialog box will be invoked when a row is double-clicked.

Example

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

Dim g_bEnableDialog

If (g_bEnableDialog = True) Then

g_bEnableDialog = False

Else

g_bEnableDialog = True

End If

 

CasCtrl.EnableDClickPropDlg g_bEnableDialog

End Sub

Back to top

EnableRule

The EnableRule method enables or disables the specified rule or set of rules for the specified level. True enables the rule or vector; False disables it.

Syntax

EnableRule(Name As String, Enable As Boolean)

Parameters

Parameter Required Description

Name

Yes

The name of the rule(s) to enable or disable.

Enable

Yes

If this parameter is set to True, the rule(s) will be enabled.  Otherwise, the rule(s) will be disabled.

Example

The following example toggles the enabled state of TestRule.

Sub enableRule()

If enableState = True Then

CasCtrl.EnableRule "TestRule", False

enableState = False

Else

CasCtrl.EnableRule "TesRule", True

enableState = True

End If

 

CasCtrl.RefreshContents

MsgBox enableState

End Sub

Back to top

EnableSound

The EnableSound method enables or disables sounds for a particular alarm priority category.

Syntax

EnableSound(Enable As Boolean, Category As Long, SoundFilePath As String)

Parameters

Parameter Required Description

Enable

Yes

If this parameter is set to True, sounds will be enabled for the alarm priority category number specified in the Category parameter.  Otherwise, sounds will be disabled for that Category.

Category

Yes

The category of the alarm that will play a sound.

SoundFilePath

Yes

The file path or blob path to the sound file to be played.

Remarks

If enabled, a sound will play when an alarm goes off. Different alarm categories can be configured to trigger different sounds.

Example

Sub btnEnableSound_EventClick()

Dim This : Set This = btnEnableSound

Dim bRet

Dim bEnable

Dim lCategory

Dim strFilePath

 

If bEnable = True then

bEnable = False

Else

bEnable = True

End If

 

lCategory = "GASCONTROL"

strFilePath = "C:\sound.wav"

 

bRet = CasCtrl.EnableSound(bEnable, lCategory, strFilePath)

 

If (bRet <> True) Then

Msgbox("Error in EnableSound!")

End If

 

End Sub

Back to top

GetAlarmRefreshSec

The GetAlarmRefreshSec method returns the alarm refresh rate in seconds.

Syntax

GetAlarmRefreshSec() As Long

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim lAlarmSec

lAlarmSec = CasCtrl.GetAlarmRefreshSec

txtTool = lAlarmSec

End Sub

Back to top

GetCASViewCustomAttribute

The GetCASViewCustomAttribute method returns the value of a CAS View Control custom attribute by either the supplied attribute name or description.

Syntax

GetCASViewCustomAttribute(AttributeNameOrDesc As String) as String

Parameters

Parameter Required Description

AttributeNameorDesc

Yes

The name or description of the custom attribute for which to retrieve a value.

Example

The following example retrieves the value for the first custom attribute and stores it in an edit box.

Sub getCustomAttr()

Dim strValue

strValue = CasCtrl.GetCASViewCustomAttribute("cas_view_attribute_0")

edtMessageBox.Text = "Custom attribute value is " & strValue

End Sub

Back to top

GetFilter

The GetFilter method returns the XML representation of the set of filter rules.

Syntax

GetFilter() As String

Remarks

The following is an example of the XML string returned by this method.

<XML><FilterDefinition m_dwProperty="10110"m_eOperator="4"m_iVersionXml="0"/></XML>

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim strFilter

strFilter = CasCtrl.GetFilter

txtTool.Text = strFilter

End Sub

Back to top

GetFilterString

The GetFilterString method returns the string representation of the filter.

Syntax

GetFilterString() As String

Remarks

This method returns the basic string representation of the filter (for example, "Alarm Priority > 74").

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim strFilter

strFilter = CasCtrl.GetFilterString

txtTool = strFilter

End Sub

Back to top

GetFirstVisibleAlarm

The GetFirstVisibleAlarm method returns the row of the first alarm visible on the screen.

Syntax

GetFirstVisibleAlarm() As Long

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim lFirstAlarm

lFirstAlarm = CasCtrl.GetFirstVisibleAlarm

txtTool = lFirstAlarm

End Sub

Back to top

GetGridValueForTag

The GetGridValueForTag method returns the grid value for a specified point property.

Syntax

GetGridValue(Tag As String, Property As String) As String

Parameters

Parameter Required Description

Tag

Yes

The tag of the point from which to retrieve the property value.

Property

Yes

The property of which the grid value will be retrieved.  This parameter must be in SITE.SERVICE.POINTID:LONGPOINTID format.

Remarks

The value returned by this method is the value shown in the CAS View Control grid for the specified property.

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim GridValue

GridValue = CasCtrl.GetPropertyForTag(Tag, "Alarm Condition")

txtTool = GridValue

End Sub

Back to top

GetLastVisibleAlarm

The GetLastVisibleAlarm method returns the row of the last alarm visible on the screen.

Syntax

GetLastVisibleAlarm() As Long

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim lLastAlarm

lLastAlarm = CasCtrl.GetLastVisibleAlarm

txtTool = lLastAlarm

End Sub

Back to top

GetNumberRows

The GetNumberRows method returns the total number of rows (alarms) in the grid.

Syntax

GetNumberRows() As Long

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim lNumberRows

lNumberRows = CasCtrl.GetNumberRows

txtTool = lNumberRows

End Sub

Back to top

GetPropertyForTag

The GetPropertyForTag method returns a property value for a specified point.

Syntax

GetPropertyForTag(Tag As String, Property As String) As String

Parameters

Parameter Required Description

Tag

Yes

The tag of the point from which to retrieve the property value.  This parameter must be in SITE.SERVICE.POINTID:LONGPOINTID format.

Property

Yes

The property of which the value will be retrieved.

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim strProperty

strProperty = CasCtrl.GetPropertyForTag(Tag, "Alarm Condition")

txtTool = strProperty

End Sub

Back to top

GetRuleNames

The GetRuleNames method returns the names of all rules or sets of rules that have a configured name for the specified level. Separate arrays are returned for rules that are enabled and for rules that are disabled.

Syntax

GetRuleNames(EnabledNames As Variant[out], DisabledNames As Variant[out])

Parameters

Parameter Required Description

EnabledNames

Yes

The array of enabled rule names returned by this method.

DisabledNames

Yes

The array of disabled rule names returned by this method.

Example

The following example retrieves two arrays of enabled and disabled rule names, then displays them in two listboxes.

Sub getRuleNames()

Dim arrEnabled, arrDisabled, item

CasCtrl.GetRuleNames arrEnabled, arrDisabled

 

'Add enabled names to a list box

For Each item In arrEnabled

lboEnabled.AddString(item)

Next

 

'Add disabled names to a list box

For Each item In arrDisabled

lboDisabled.AddString(item)

Next

End Sub

Back to top

GetRunningServices

The GetRunningServices method returns the alarm category of the selected alarm.

Syntax

GetRunningServices() As Variant

Example

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

Dim iBndLower

Dim iBndUpper

Dim arrServiceList

Dim nItem

 

ListBox1.ResetContent

 

arrServiceList = CasCtrl.GetRunningServices

 

iBndLower = LBound(arrServiceList)

iBndUpper = UBound(arrServiceList)

 

For nItem = iBndLower To iBndUpper

ListBox1.AddString CStr(arrServiceList(nItem))

Next

End Sub

Back to top

GetSelectedAlarmCategory

The GetSelectedAlarmCategory method returns the alarm category of the selected alarm.

Syntax

GetSelectedAlarmCategory() As String

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim strCategory

strCategory = CasCtrl.GetSelectedAlarmCategory

txtTool = strCategory

End Sub

Back to top

GetSelectedAlarmFacility

The GetSelectedAlarmFacility method returns the facility ID of the selected alarm.

Syntax

GetSelectedAlarmFacility() As String

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim strFacility

strFacility = CasCtrl.GetSelectedAlarmFacility

txtTool = strFacility

End Sub

Back to top

GetSelectedAlarmPointID

The GetSelectedAlarmPointId method returns the short point ID of the selected alarm.

Syntax

GetSelectedAlarmPointID() As String

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim strPointID

strPointID = CasCtrl.GetSelectedAlarmPointID

txtTool = strPointID

End Sub

Back to top

GetSelectedAlarmPointIDLong

The GetSelectedAlarmPointIdLong method returns the long point ID of the selected alarm.

Syntax

GetSelectedAlarmPointIDLong() As String

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim strLongID

strLongID = CasCtrl.GetSelectedAlarmPointIDLong

txtTool = strLongID

End Sub

Back to top

GetSelectedAlarmPriority

The GetSelectedAlarmPriority method returns the alarm priority of the selected alarm.

Syntax

GetSelectedAlarmPriority() As Integer

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim iPriority

iPriority = CasCtrl.GetSelectedAlarmPriority

txtTool = iPriority

End Sub

Back to top

GetSelectedAlarms

The GetSelectedAlarms method returns an array of point tags of the currently-selected alarms.

Syntax

GetSelectedAlarms()As Variant

Remarks

The point tags included in the returned array are in SITE.SERVICE.POINTID:LONGPOINTID format.

Example

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

Dim iBndLower

Dim iBndUpper

Dim arrAlarmList

Dim nItem

 

ListBox1.ResetContent

 

arrAlarmList = CasCtrl.GetSelectedAlarms

 

iBndLower = LBound(arrAlarmList)

iBndUpper = UBound(arrAlarmList)

 

For nItem = iBndLower To iBndUpper

ListBox1.AddString CStr(arrAlarmList(nItem))

Next

 

End Sub

Back to top

GetSelectedAlarmService

The GetSelectedAlarmService method returns the service of the selected alarm.

Syntax

GetSelectedAlarmService() As String

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim strService

strService = CasCtrl.GetSelectedAlarmService

txtTool = strService

End Sub

Back to top

GetSelectedAlarmSite

The GetSelectedAlarmSite method returns the site of the selected alarm.

Syntax

GetSelectedAlarmSite() As String

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim strSite

strSite = CasCtrl.GetSelectedAlarmSite

txtTool = strSite

End Sub

Back to top

GetSelectedAlarmStatus

The GetSelectedAlarmStatus method returns the status of the selected alarm.

Syntax

GetSelectedAlarmStatus() As Integer

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim iAlarmStatus

iAlarmStatus = CasCtrl.GetSelectedAlarmStatus

txtTool = iAlarmStatus

End Sub

Back to top

GetSelectedAlarmTimestamp

The GetSelectedAlarmTimestamp method returns the latest timestamp of the selected alarm.

Syntax

GetSelectedAlarmTimestamp() As String

Remarks

This method returns a string including the date and time, in 24-hour time notation (for example, "5/28/2019 15:01:46.624").

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim strTimestamp

strTimestamp = CasCtrl.GetSelectedAlarmTimestamp

txtTool = strTimestamp

End Sub

Back to top

GetSelectedAlarmUniformDataCode

The GetSelectedAlarmUniformDataCode method returns the uniform data code of the selected alarm.

Syntax

GetSelectedAlarmUniformDataCode() As String

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim strDataCode

strDataCode = CasCtrl.GetSelectedAlarmUniformDataCode

txtTool = strDataCode

End Sub

Back to top

GetSelectedAlarmUserStatus

The GetSelectedAlarmUserStatus method returns the user status of the selected alarm.

Syntax

GetSelectedAlarmUserStatus() As Long

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim lAlarmSec

lAlarmSec = CasCtrl.GetSelectedAlarmUserStatus

txtTool = lAlarmSec

End Sub

Back to top

GetSelectedAlarmValue

The GetSelectedAlarmValue method returns the value of the selected alarm.

Syntax

GetSelectedAlarmValue() As String

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim strAlarmValue

strAlarmValue = CasCtrl.GetSelectedAlarmValue

txtTool = strAlarmValue

End Sub

Back to top

GetServiceVersionNumber

The GetServiceVersionNumber method returns the service version of the currently-selected alarm.

Syntax

GetServiceVersionNumber() As Long

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim lServiceVersion

lServiceVersion = CasCtrl.GetServiceVersionNumber

txtTool = lServiceVersion

End Sub

Back to top

GetStoppedServices

The GetStoppedServices method returns the list of stopped services.

Syntax

GetStoppedServices() As Variant

Example

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

Dim iBndLower

Dim iBndUpper

Dim arrStoppedService

Dim nItem

 

ListBox1.ResetContent

 

arrStoppedService = CasCtrl.GetStoppedServices

 

iBndLower = LBound(arrStoppedService)

iBndUpper = UBound(arrStoppedService)

 

For nItem = iBndLower To iBndUpper

ListBox1.AddString CStr(arrStoppedService (nItem))

Next

 

End Sub

Back to top

GetTagForRow

The GetTagForRow method returns the alarm tag for the specified row.

Syntax

GetTagForRow(Row As Long) As String

Parameters

Parameter Required Description

Row

Yes

The row for which the alarm tag will be retrieved.

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim strTag

strTag = CasCtrl.GetTagForRow(10)

txtTool = strTag

End Sub

Back to top

GetTooltipRow

The GetTooltipRow method returns tooltip row information.

Syntax

GetTooltipRow() As Long

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim lTooltipRow

lTooltipRow = CasCtrl.GetTooltipRow

txtTool = lTooltipRow

End Sub

Back to top

GetTooltipString

The GetTooltipString method returns the tooltip display string.

Syntax

GetTooltipString() As String

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

Dim strTooltipString

strTooltipString = CasCtrl.GetTooltipString

txtTool = strTooltipString

End Sub

Back to top

GetTooltipText

The GetTooltipText method returns tooltip text information.

Syntax

GetTooltipText(TooltipRow As Long) As String

Parameters

Parameter Required Description

TooltipRow

Yes

The row for which the tooltip text information will be retrieved.

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

strToolTip = CasCtrl.GetTooltipText(iRow)

txtTool = strToolTip

End Sub

Back to top

IsSelectedAlarmAck

The IsSelectedAlarmAck method returns True if the currently-selected alarm is acknowledged.

Syntax

IsSelectedAlarmAck() As Boolean

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

If CasCtrl.IsSelectedAlarmAck = True Then

txtTool = "True"

Else

txtTool = "False"

End If

End Sub

Back to top

IsSelectedAlarmClear

The IsSelectedAlarmClear method returns True if the currently-selected alarm is clear.

Syntax

IsSelectedAlarmClear() As Boolean

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

If CasCtrl.IsSelectedAlarmClear = True Then

txtTool = "True"

Else

txtTool = "False"

End If

End Sub

Back to top

IsSelectedAlarmHidden

The IsSelectedAlarmHidden method returns True if the currently-selected alarm is hidden.

Syntax

IsSelectedAlarmHidden() As Boolean

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

If CasCtrl.IsSelectedAlarmHidden = True Then

txtTool = "True"

Else

txtTool = "False"

End If

End Sub

Back to top

IsSelectedAlarmSet

The IsSelectedAlarmSet method returns True if the currently-selected alarm is set.

Syntax

IsSelectedAlarmSet() As Boolean

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

If CasCtrl.IsSelectedAlarmSet = True Then

txtTool = "True"

Else

txtTool = "False"

End If

End Sub

Back to top

IsSelectedAlarmSuppressed

The IsSelectedAlarmSuppressed method returns True if the currently-selected alarm is suppressed.

Syntax

IsSelectedAlarmSuppressed() As Boolean

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

If CasCtrl.IsSelectedAlarmSuppressed = True Then

txtTool = "True"

Else

txtTool = "False"

End If

End Sub

Back to top

IsShowAlarmColor

The IsShowAlarmColor method returns the value of the ShowLineColor property.

Syntax

IsShowAlarmColor() As Boolean

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

If CasCtrl.IsShowAlarmColor = True Then

txtTool = "True"

Else

txtTool = "False"

End If

End Sub

Back to top

IsWrapColumns

The IsWrapColumns method returns the value of the WrapColumns property.

Syntax

IsWrapColumns() As Boolean

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

If CasCtrl.IsWrapColumns = True Then

txtTool = "True"

Else

txtTool = "False"

End If

End Sub

Back to top

MenuSelection

The MenuSelection method selects an item from the context menu.

Syntax

MenuSelection(MenuSel As Integer)

Parameters

Parameter Required Description

MenuSel

Yes

The number code for the menu selection.

Remarks

The MenuSel parameter can be one of the following integers.

Menu Action Code
Filter  1000
Columns  1001
Clear  1002
Properties  1003
Acknowledge  1004
Configure_Alarm 1005
Configure_Comment 1006
Configure_All 1007
Force_Clear 1008
Hide  1009
Unhide  1010
Stats  1011
Select_All 1012
Line_Color 1013
Auto_Config 1014
Print_Report 1015
Refresh  1016
Wrap_Cols  1017
Acknowledge_Visible 1018
History  1019
Sound  1020
Suppress  1021

Example

Sub CasCtrl_EventAlarmDblClicked(iRow, Tag)

Dim This : Set This = CasCtrl

'Calls the suppression dialog box

CasCtrl.MenuSelection(1021)

End Sub

Back to top

Properties

The Properties method invokes a Point Properties dialog box for the currently-selected alarm.

Syntax

Properties()

Example

Sub CasCtrl_EventAlarmSelected(iRow, Tag)

Dim This : Set This = CasCtrl

CasCtrl.Properties

End Sub

Back to top

RefreshContents

The RefreshContents method refreshes the contents of the CAS View control with all alarms that meet the configured set of rules. After modifying the filter rules, this must be called to reset the view with the changes.

Syntax

RefreshContents()

Remarks

Call this method to update the grid after calling any other method that changes the CAS display.

Example

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

CasCtrl.RefreshContents

End Sub

Back to top

RemoveFilter

The RemoveFilter method removes a filter specified by a property, operator, and value.

Syntax

RemoveFilter(Property As String, Operator As String, Value As String) As Boolean

Parameters

Parameter Required Description

Property

Yes

The property being filtered.

Operator

Yes

The operator that compares the property to the value.

Value

Yes

The value being compared to the property.

Remarks

This is an obsolete legacy function. For compatibility, it will remove the specified rule if it is found in the highest-level rule set only.

This method will return False if there is an error removing the filter.

Example

Sub btnRemoveFilter_EventClick()

Dim This : Set This = btnRemoveFilter

Dim bRet

Dim strProperty

Dim strOperator

Dim strValue

 

strProperty = "Primary Value"

strOperator = ">"

strValue = 600

 

bRet = CasCtrl.RemoveFilter(strProperty, strOperator, strValue)

 

If (bRet <> True) Then

Msgbox("Error in RemoveFilter!")

End If

 

CasCtrl.RefreshContents

 

End Sub

Back to top

RequestAlarmRefreshRateChange

The RequestAlarmRefreshRateChange method requests a change in the shared alarm cache refresh rate.

Syntax

RequestAlarmRefreshRateChange(RequestedSeconds As Long, ActualRefreshSeconds As Variant) As Boolean

Parameters

Parameter Required Description

RequestedSeconds

Yes

The requested number of seconds between shared alarm cache refreshes.

ActualRefreshSeconds

Yes

The actual refresh rate of the shared alarm cache returned by this method, in seconds.

Remarks

This method will return True upon success and False upon failure.

This method will only succeed if the request refresh rate is faster than that of other shared controls in the application.

Example

The following example requests a shared alarm cache refresh rate of 10 seconds, and displays the actual refresh rate in a message box.

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

Dim nRefreshRate

CasCtrl.RequestAlarmRefreshRateChange(10, nRefreshRate)

 

MsgBox nRefreshRate

End Sub

Back to top

RestoreInitialFilter

The RestoreInitialFilter method restores the filter state to the original filter that is configured for the control.

Syntax

RetoreInitialFilter()

Example

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

CasCtrl.RestoreInitialFilter

CasCtrl.RefreshContents

End Sub

Back to top

SelectAlarms

The SelectAlarms method selects a range of alarms.

Syntax

SelectAlarms(FirstAlarm As Long, LastAlarm As Long) As Boolean

Parameters

Parameter Required Description

FirstAlarm

Yes

The first alarm in the range to select.

LastAlarm

Yes

The last alarm in the range to select.

Example

Sub btnSuppress_EventClick()

Dim This : Set This = btnSuppress

Dim firstAlarm

Dim lastAlarm

 

firstAlarm = edtAlarm1.Text

lastAlarm = edtAlarm2.Text

 

CasCtrl.SelectAlarms firstAlarm, lastAlarm

End Sub

Back to top

SetAlarmRefreshSec

The SetAlarmRefreshSec method sets the alarm refresh rate in seconds.

Syntax

SetAlarmRefreshSec(Seconds As Long)

Parameters

Parameter Required Description

Seconds

Yes

The amount of time in seconds to wait between alarm refreshes.

Example

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

Dim lSeconds

lSeconds = edtTool.Text

casctrl.SetAlarmRefreshSec(lSeconds)

End Sub

Back to top

SetCASViewCustomAttribute

The SetCASViewCustomAttribute method sets the value of a CAS View Control custom attribute identified by either the attribute name or description.

Syntax

SetCASViewCustomAttribute(AttributeNameOrDesc As String, Value As String)

Parameters

Parameter Required Description

AttributeNameOrDesc

Yes

The name or description of the custom attribute for which to set a value.

Value

Yes

The value to set for the attribute.

Example

The following example demonstrates the two ways to set a custom attribute. The first method uses the custom attribute’s description, and the second method uses the custom attribute’s name.

Sub setCustomAttr()

'Set by custom attribute description

CasCtrl.SetCASViewCustomAttribute "View Facility", "CygDemo_RTU"

 

'Set by custom attribute name

CasCtrl.SetCASViewCustomAttribute "cas_view_attribute_0", "CygDemo_RTU"

End Sub

Back to top

SetControlLabel

The SetControlLabel method sets the control’s label for identification in the log file.

Syntax

SetControlLabel(Label As String)

Parameters

Parameter Required Description

Label

Yes

The prefix used to identify the control in the log file.

Remarks

The prefix specified in the Label parameter is only appended to logs of certain errors and actions.

Example

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

CasCtrl.SetControlLabel("CAS Screen")

End Sub

Back to top

SetFilter

The SetFilter method creates a filter rule set for the CAS View Control with the provided XML string.

Syntax

SetFilter(Filter As String)

Parameters

Parameter Required Description

Filter

Yes

The XML representing the filter to create.

Remarks

The XML specified in the Filter parameter is in the same format as the XML returned by the GetFilter method. This function will accept the obsolete form of the Filter XML String from previous versions of the CAS View Control GetFilter function.

Example

Sub ButtonTool5_EventClick()

Dim This : Set This = ButtonTool5

Dim NewFilter

NewFilter = edtBox.Text

'<XML><FilterDefinition m_dwProperty="10110" m_eOperator="4"

'm_iVersionXml="0" m_strValues="74"/></XML>

 

CasCtrl.SetFilter (edtBox.Text)

casctrl.RefreshContents

End Sub

Back to top

SetSiteServices

The SetSiteServices method sets the list of Site.Services for which to display alarms.

Syntax

SetSiteServices(SiteServiceList As String)

Parameters

Parameter Required Description

SiteServiceList

Yes

The semicolon-delimited list of Site.Services for which to display alarms.

Example

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

If lstBox.Selection = 0 Then

CasCtrl.SetSiteServices("Company1.CAS")

Elseif lstBox.Selection = 1 Then

CasCtrl.SetSiteServices("Company2.CAS")

Elseif lstBox.Selection = 2 Then

CasCtrl.SetSiteServices("Company3.CAS")

Else

CasCtrl.SetSiteServices("Company4.CAS")

End If

CasCtrl.RefreshContents

End Sub

Back to top

SetSort

The SetSort method sets the sorting options.

Syntax

SetSort(SortOrdinal As Long, Property As String, Ascending As Boolean) As Boolean

Parameters

Parameter Required Description

SortOrdinal

Yes

The priority of the sort. The possible values for this parameter are 0, 1, and 2, with 0 being the highest sort priority.

Property

Yes

The property to sort.

Ascending

Yes

If this parameter is set to True, to the grid will sort in ascending order (A-Z).  Otherwise, the grid will sort in descending order (Z-A).

Example

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

Dim bRet

 

bRet = CasCtrl.SetSort(0, "Primary Value", False)

 

If bRet = "False" Then

msgbox "Error"

End If

 

CasCtrl.RefreshContents

End Sub

Back to top

SetTooltipString

The SetTooltipString method sets the tooltip display string.

Syntax

SetTooltipString(TooltipString As String)

Parameters

Parameter Required Description

TooltipString

Yes

The text to be displayed in the tooltip.

Example

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

strTooltip = CasCtrl.GetTooltipString

 

strTooltip = CasCtrl.TooltipTokenDlg

CasCtrl.SetTooltipString strTooltip

 

End Sub

Back to top

SetVisibleRow

The SetVisibleRow method automatically selects and scrolls the grid to the specified row.

Syntax

SetVisibleRow(Row As Long) As Long

Parameters

Parameter Required Description

Row

Yes

The number of the row to make visible.

Example

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

Dim lValue

lValue = edtVisibleRow.Text

CasCtrl.SetVisibleRow lValue

End Sub

Back to top

ShowHiddenAlarms

The ShowHiddenAlarms method sets whether or not hidden alarms are shown.

Syntax

ShowHiddenAlarms(ShowHidden As Boolean)

Parameters

Parameter Required Description

ShowHidden

Yes

If this parameter is set to True, hidden alarms will be shown.  Otherwise, hidden alarms will not be shown.

Example

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

Dim g_bShowHidden

If (g_bShowHidden = True) Then

g_bShowHidden = False

Else

g_bShowHidden = True

End If

CasCtrl.ShowHiddenAlarms g_bShowHidden

CasCtrl.RefreshContents

End Sub

Back to top

SilenceAlarms

The SilenceAlarms method silences all alarms that would cause sounds that are older than or equal to the provided timestamp.

Syntax

SilenceAlarms(SilenceTime)

Parameters

Parameter Required Description

SilenceTime

No

This parameter is optional, if not specified the current time will be used. Any new alarms that come in after the time specified will cause sounds to play again.

Example

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

CasCtrl.SilenceAlarms

End Sub

Back to top

StartRefresh

The StartRefresh method starts display refresh.

Syntax

StartRefresh()

Example

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

CasCtrl.StartRefresh

End Sub

Back to top

StopRefresh

The StopRefresh method stops display refresh.

Syntax

StopRefresh()

Example

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

CasCtrl.StopRefresh

End Sub

Back to top

TooltipTokenDlg

The TooltipTokenDlg method displays a Tooltip Message Chooser dialog box, and returns the selected token string.

Syntax

TootltipTokenDIg() As String

Example

Sub ButtonTool_EventClick()

Dim This : Set This = ButtonTool

strTooltip = CasCtrl.GetTooltipString

strTooltip = CasCtrl.TooltipTokenDlg

CasCtrl.SetTooltipString strTooltip

End Sub

Back to top

Let us know how we can improve this topic.

CygNet at weatherford.com

© 2020 Weatherford. All rights reserved.